<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusAccidentRepairTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_accident_repair', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->date('date')->nullable()->comment('维修时间');
            $table->string('content')->nullable()->comment('维修内容');
            $table->string('type')->nullable()->comment('维修内容');
            $table->decimal('cost', 10, 2)->nullable()->comment('维修费用');
            $table->unsignedBigInteger('accident_id')->comment('事故ID');
            $table->foreign('accident_id')->references('id')->on('akbus_accident')->onDelete('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_accident_repair');
    }
}
